<?php

namespace App\Console\Commands\Redis;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;

class ListStruct extends Command
{
    protected $signature = 'redis:list';

    public function handle()
    {
      Redis::lpush('list', ['v1', 'v2', 'v3']);  // 追加元素
      Redis::rpush('list', ['right append']);  // 追加元素
      var_dump(Redis::lrange('list', 0, -1)); // 获得所有元素
      var_dump(Redis::lindex('list', 5)); // 获得索引处为5的值
    }
}
